// import { useState } from 'react'
import { Button, Form, Input, message, Checkbox } from 'antd';
import "antd/dist/antd.css";
import '../login.css'
import { poregister } from '../../plugins/getlogin'
// const [city, setCity] = useState("北京");
export const Register = () => {
    const onFinish = (values) => {
        poregister(values)
        message.success({
            content: '注册成功！',
            className: 'custom-class',
            style: {
                marginTop: '20vh',

            },
        });

    };
    const onFinishFailed = (errorInfo) => {
        message.error({
            content: '注册失败，请查看信息是否填写完整！',
            className: 'custom-class',
            style: {
                marginTop: '20vh',

            },
        });
    };
    var style = {
        width: '100%',

    };

    return (
        <Form
            className='noform'
            name="basics"
            labelAlign='left'
            labelCol={{
                span: 8,
            }}
            wrapperCol={{
                span: 16,
            }}
            initialValues={{
                remember: true,
            }}
            onFinish={onFinish}
            onFinishFailed={onFinishFailed}
            autoComplete="off"
        >
            <Form.Item
                label="用户名"
                name="username"
                rules={[
                    {
                        required: true,
                        message: '请输入用户名!',
                    },
                ]}
            >
                <Input />
            </Form.Item>

            <Form.Item
                label="密 码"
                name="password"
                rules={[
                    {
                        required: true,
                        message: '请输入你的密码!',
                    },
                ]}
            >
                <Input.Password />
            </Form.Item>

            <Form.Item
                name="remember"
                valuePropName="checked"
                wrapperCol={{
                    offset: 8,
                    span: 12,
                }}
            >
                <Checkbox>记住密码</Checkbox>
            </Form.Item>
            <Form.Item
                wrapperCol={{
                    offset: 8,
                    span: 12,
                }}
            >
                <Button type="primary" htmlType="submit" style={style} size='large'>
                    注册
                </Button>
            </Form.Item>
        </Form>

    )
}